import Model from "./Model"
// import {head} from '@/utils/lodash.min.js'
import calc from '@/utils/calc.js'
import lodash from '@/utils/lodash.js'

class StrategyInfoModel extends Model {
	constructor () {
	super()
		this.id = ''
		this.tag = ''
		this.name = ''
		this.code = ''
		this.type = ''
		this.priceList = []
		
		this.traderList = []
		this.strategyPositions = []
		
		this.price = 0
		this.original_price = 0
		//	收藏
		this.collection = ''
		this.left_stock = ''
		this.subscribed=0
	}
	
	//  字段过滤
	fields() {
		const fields = super.fields()
		const price = lodash.head(this.priceList)
		if (price) {
			fields['price'] = () => {
				return calc.Div(price['price'], 100)
			}
			fields['original_price'] = () => {
				return calc.Div(price['original_price'], 100)
			}
		}
		
		return fields
	}

}
    
export default StrategyInfoModel